﻿@using KMF.WebUI.Areas.KMFadmin.CustomHelpers
@using KMF.WebUI.Areas.KMFadmin.Models
@model IEnumerable<KMF.Common.ViewConfigPagingDto>
@{
    ViewBag.Title = "Thông tin cấu hình";
    Layout = "~/Areas/KMFadmin/Views/Shared/_layout.cshtml";
}
@section LeftMenu
{
    <div id="left">
        <div class="LeftMenuWraper">
            <div class="leftMenuHeader">
                <span style="padding-left: 10px;">
                    <strong>Truy cập nhanh</strong>
                </span>
            </div>
            <ul id="p-quick-menu" class="quick-menu">
                <li class="qmn-info-pro">
                    <a href="@Url.Action("Index", "/KMFadmin/AdminWebInfo")">Thông tin website</a>
                </li>
                <li class="qmn-info-pro">
                    <a href="@Url.Action("Index", "/KMFadmin/AdminConfig")">Thông tin tĩnh</a>
                </li>
                <li class="qmn-info-pro"><a href="@Url.Action("Index", "/KMFadmin/AdminConfigSystem")">Cấu hình hệ thống</a></li>
                <li class="qmn-info-pro"><a href="@Url.Action("ConfigFilter", "/KMFadmin/AdminProductFilter")">Cấu hình bộ lọc</a></li>
            </ul>
            <div class="leftMenuFooter"></div>
        </div>
    </div>
    <!-- END #left -->
}
<nav>
    <div id="jCrumbs" class="breadCrumb module">
        <ul>
            <li><a href="@Url.Action("Index","AdminHome")"><i class="bootstrap icon-home"></i></a></li>
            <li><a href="javascript:void(0)">Danh sách thông tin website</a> </li>
        </ul>
    </div>
</nav>

<div class="toolBox">
    @Html.ToolBox(new List<object> { new Add { ClassCss = "Add", ActionName = "/KMFadmin/AdminConfig/Add" } })
</div>
<div style="overflow:hidden;">
    <table class="table-odd table-plist">
        <tr>
            <th style="width: 30px">STT</th>
            <th scope="col">Mô tả</th>
            <th style="width: 300px">Key</th>
            <th style="width: 90px">Kiểu nội dung</th>
            <th style="width: 50px"></th>
        </tr>
        @foreach (var item in Model)
        {
            <tr class="@string.Format("bn-{0}", item.ConfigId)">
                <td>@item.STT</td>
                <td>
                    @item.Description
                </td>
                <td>
                    @item.Key
                </td>
                <td>
                    @item.Type
                </td>
                <td>
                    <a href="@Url.Action("Edit", "AdminConfig", new { configId = item.ConfigId })" title="chỉnh sửa" class="icon-edit-v2 fl-l bootstrapTangoSmall"></a>
                    @Ajax.ActionLink("Xóa", "Delete", "AdminConfig", new { configId = item.ConfigId }, new AjaxOptions
                                                                                                 {
                                                                                                     Confirm = "Bạn chắc chắn muốn xóa thông tin này!",
                                                                                                     OnSuccess = "AjaxReturnDataDeleteConfig"
                                                                                                 }, new { @class = "icon-delete fl-l bootstrapTangoSmall", title = "chỉnh sửa" })
                </td>
            </tr>
        }
    </table>
</div>
<div class="p-paging">
    @Html.PageLinks((PageInfo)ViewBag.PageInfo, i => Url.Action("Index", "AdminConfig", new { page = i }))
</div>

@section scripts
{
    <script src="~/Areas/KMFadmin/Scripts/jquery.unobtrusive-ajax.min.js"></script>
    <script type="text/javascript">
        function AjaxReturnDataDeleteConfig(data) {
            if (data) {
                window.location = document.URL;
            }
        }
    </script>
}

